Skip to content

fix: make prefresh hmr integration easier - #728

Merged
marvinhagemeister merged 1 commit into
mainfrom
signal-hmr
Jul 29, 2025
Merged

fix: make prefresh hmr integration easier#728
marvinhagemeister merged 1 commit into
mainfrom
signal-hmr

Conversation

@marvinhagemeister

Copy link
Copy Markdown
Member

The callback to useMemo is assumed to be pure during HMR and will be re-triggered. This in turn broke the useSignal hooks HMR as they used side-effectful callbacks.

@netlify

netlify Bot commented Jul 29, 2025

Copy link
Copy Markdown

Deploy Preview for preact-signals-demo ready!

Name Link
🔨 Latest commit 0fd9503
🔍 Latest deploy log https://app.netlify.com/projects/preact-signals-demo/deploys/6888b29607c89d0008ebb6e5
😎 Deploy Preview https://deploy-preview-728--preact-signals-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@marvinhagemeister
marvinhagemeister marked this pull request as draft July 29, 2025 11:16
@github-actions

github-actions Bot commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

Size Change: -210 B (-0.24%)

Total Size: 87.3 kB

Filename Size Change
docs/dist/assets/index.********.js 834 B -245 B (-22.71%) 🎉
docs/dist/assets/signals.module.********.js 2.45 kB +7 B (+0.29%)
docs/dist/basic-********.js 244 B +1 B (+0.41%)
packages/preact/dist/signals.js 1.58 kB +12 B (+0.76%)
packages/preact/dist/signals.mjs 1.55 kB +15 B (+0.98%)
ℹ️ View Unchanged
Filename Size
docs/dist/assets/bench.********.js 1.59 kB
docs/dist/assets/client.********.js 46.2 kB
docs/dist/assets/jsxRuntime.module.********.js 295 B
docs/dist/assets/preact.module.********.js 4.71 kB
docs/dist/assets/signals-core.module.********.js 1.56 kB
docs/dist/assets/style.********.js 21 B
docs/dist/assets/style.********.css 1.24 kB
docs/dist/nesting-********.js 1.13 kB
docs/dist/react-********.js 242 B
packages/core/dist/signals-core.js 1.59 kB
packages/core/dist/signals-core.mjs 1.6 kB
packages/debug/dist/debug.js 1.74 kB
packages/debug/dist/debug.mjs 1.31 kB
packages/react-transform/dist/signals-*********.js 5.93 kB
packages/react-transform/dist/signals-transform.mjs 5.12 kB
packages/react-transform/dist/signals-transform.umd.js 6.04 kB
packages/react/dist/signals.js 188 B
packages/react/dist/signals.mjs 150 B

compressed-size-action

@changeset-bot

changeset-bot Bot commented Jul 29, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0fd9503

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@preact/signals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

The callback to `useMemo` is assumed to be pure during HMR and will be re-triggered. This in turn broke the `useSignal` hooks HMR as they used side-effectful callbacks.
@marvinhagemeister
marvinhagemeister marked this pull request as ready for review July 29, 2025 11:38
() => signal<T | undefined>(value, options as SignalOptions),
[]
);
return useState(() =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever!

@marvinhagemeister
marvinhagemeister merged commit a023a13 into main Jul 29, 2025
6 checks passed
@marvinhagemeister
marvinhagemeister deleted the signal-hmr branch July 29, 2025 11:43
@github-actions github-actions Bot mentioned this pull request Jul 29, 2025
() => signal<T | undefined>(value, options as SignalOptions),
[]
);
return useState(() =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per a chat with @JoviDeCroock, would using useState prevent the SCU optimizations (which bail early if there are useState usages in a component)?

@github-actions github-actions Bot mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants